<template>
  <div class="box-singer">
    <div class="g-wrap">
      <h2 class="sname">{{ artist.name }}</h2>
      <div class="img">
        <img :src="artist.cover" alt="">
      </div>
      <div class="f-alpha"></div>
      <router-link :to="{name:'UserDetail',params:{id:user.userId}}" class="artist-home" v-if="user">Ta的个人主页</router-link>
      <a href="#" class="artist-sub">收藏</a>
    </div>
    <ul class="tab">
      <li :class="path===p.path?'active':''" v-for="(p,i) in tab" :key="i">
        <router-link :to="{name:p.path}">{{ p.name }}</router-link>
      </li>
    </ul>
  </div>
</template>

<script>

export default {
  name: "index",
  props: ['artist','user'],
  data() {
    return {
      tab: [
        {name: '热门作品', path: 'Work'},
        {name: '所有专辑', path: 'Album'},
        {name: '相关mv', path: 'MV'},
        {name: '艺人介绍', path: 'Introduction'},
      ],
      path:''
    }
  },
  methods: {},
  computed: {},
  mounted() {
    this.path = this.$route.path.split('/')[2]
  }
}
</script>

<style scoped lang="less">
.box-singer {
  width: 640px;
  margin: 0 auto;

  .g-wrap {
    width: 640px;
    margin: 0 auto;
    padding-top: 30px;
    height: 333px;
    position: relative;

    .sname {
      float: left;
      max-width: 100%;
      height: 34px;
      line-height: 24px;
      font-weight: normal;
      font-size: 24px;
      color: #333;
    }

    .img {
      width: 640px;
      height: 300px;
      overflow: hidden;
      position: relative;

      img {
        width: 100%;
        position: absolute;
        top: -110px;
      }
    }

    .f-alpha {
      display: block;
      width: 640px;
      height: 300px;
      position: absolute;
      top: 65px;
      left: 0;
      background: url("../../../assets/ban_mask.png") no-repeat;
    }

    .artist-home {
      display: block;
      position: absolute;
      bottom: 18px;
      right: 116px;
      width: 96px;
      height: 32px;
      text-indent: -999px;
      background-position: 0 -1156px;
      background-image: url("../../../assets/iconall.png");
    }

    .artist-sub {
      display: block;
      position: absolute;
      bottom: 18px;
      right: 20px;
      width: 76px;
      height: 32px;
      text-indent: -999px;
      background-position: 0 -500px;
      background-image: url("../../../assets/iconall.png");

    }
  }

  .tab {
    height: 39px;
    border: 1px solid #ccc;
    border-width: 0 1px;
    background: url('../../../assets/tab.png');
    background-position: 0 0;
    background-repeat: repeat-x;

    li {
      position: relative;
      float: left;
      height: 39px;
      font-size: 14px;
      width: 138px;
      text-align: center;
      line-height: 39px;

      &:hover {
        background-color: #fff;
        border-top: 3px solid rgb(245, 169, 56);
        border-left: 1px solid #ddd;
        border-right: 1px solid #ddd;
        line-height: 35px;
        cursor: pointer;
      }

      a {
        display: block;
        padding-left: 2px;
        text-decoration: none;
        color: #333;
        height: 39px;
        font-size: 14px;
        width: 100%;


      }
    }

    .active {
      background-color: #fff;
      border-top: 3px solid rgb(245, 169, 56);
      border-left: 1px solid #ddd;
      border-right: 1px solid #ddd;
      line-height: 35px;
      cursor: pointer;
    }
  }
}
</style>